<template>
  <div class="login" :style="'background-image:url(' + Background + ');'">
    <!-- 登录 -->
    <div v-if="getPassword" class="loginBox">
      <div class="leftBox"></div>
      <div class="rightBox">
        <h2>商家登录</h2>
        <el-tabs v-model="tabs.activeName">
          <el-tab-pane label="账户密码登录" name="account">
            <AccountLogin
              class="login-form"
              @forgetPassword="getPassword = false"
            />
          </el-tab-pane>
          <el-tab-pane label="手机号码登录" name="phone">
            <PhoneLogin class="login-form" />
          </el-tab-pane>
        </el-tabs>
      </div>
    </div>
    <!-- 找回密码 -->
    <RebackPassword
      v-else
      @backToLogin="() => getPassword = true"
    />
    <!--  底部  -->
    <div class="login-footer">© 2019 cereshop</div>
  </div>
</template>

<script setup>
import { defineComponent, reactive, ref } from 'vue';
import AccountLogin from './account.vue';
import PhoneLogin from './phone.vue';
import RebackPassword from './rebackPassword.vue';

import Background from '@/assets/images/background.jpg'

defineComponent({
  name: 'LoginIndex'
})

const getPassword = ref(true);

let tabs = reactive({
  activeName: 'account'
})
</script>

<style lang="scss" scoped>
.login {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  background-size: cover;
}
.leftBox {
  width: 325px;
  height: 250px;
  margin-top: 150px;
  background: url('../../assets/images/home-content.png') 50% no-repeat;
  background-size: cover;
}
.rightBox {
  margin: auto;
  h2 {
    text-align: center;
  }
}

.loginBox {
  width: 900px !important;
  height: 600px;
  display: flex;
  background: #ffffff;
  border-radius: 20px;
  padding: 30px;
  .el-tabs{
    :deep(.el-tabs__nav-wrap::after) {
      background-color: transparent;
    }
    :deep(.el-tabs__nav-scroll){
      display: flex;
      justify-content: center;
      .el-tabs__item{
        width: 150px;
        height: 50px;
        line-height: 50px;
      }
    }
  }
}

.login-form {
  border-radius: 6px;
  background: #ffffff;
  width: 385px;
  padding: 25px 25px 5px 25px;
  .el-input {
    height: 38px;
    input {
      height: 38px;
    }
  }
  .input-icon {
    height: 39px;
    width: 14px;
    margin-left: 2px;
  }
  .iptHeight {
    height: 54px !important;
    input {
      height: 54px !important;
    }
    span {
      display: flex;
      align-items: center;
    }
    .input-icon {
      width: 20px;
      height: 20px;
    }
  }
}

.login-footer {
  position: fixed;
  bottom: 0;
  width: 100%;
  text-align: center;
}
</style>
